<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="bean.entity.*,bean.dal.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<jsp:include page="top.jsp"></jsp:include>
    <%int id = Integer.parseInt(request.getParameter("id")); %>
	<script type="text/javascript" >
		function check(){
			var userid=document.getElementById('userid').value;
			var role=document.getElementById('role').value;
			var integration=document.getElementById('integration').value;
			var tel=document.getElementById('tel').value;
			var password=document.getElementById('password').value;
			var username=document.getElementById('username').value;
			var location=document.getElementById('location').value;
			if(tel==""||tel==null){
				window.alert("电话不能为空！");
				document.update.tel.focus();
				return false;
			}
			if(username==""||username==null){
				window.alert("姓名不能为空！");
				document.update.username.focus();
				return false;
			}
			if(password==""||password==null){
				window.alert("密码不能为空！");
				document.update.password.focus();
				return false;
			}
			if(location==""||location==null){
				window.alert("地址不能为空！");
				document.update.location.focus();
				return false;
			}
			if(integration==""||integration==null){
				window.alert("不能积分为空！");
				document.update.integration.focus();
				return false;
			}
			if(role==""||role==null){
				window.alert("权限不能为空！");
				document.update.role.focus();
				return false;
			}
			if(userid==""||userid==null){
				window.alert("账号不能为空！");
				document.update.userid.focus();
				return false;
			}
			return true;
		}
		function deleted(){
			location.href="/express/servlet/UserLogin?modth=deleted&id=<%=id%>";
		}
	</script>


	<%
		String msg = (String) session.getAttribute("msg");
		session.setAttribute("msg","");
		User user= new User();
		UserManager userM=new UserManager();
		user=userM.getUserById(id);
	%>
    <form id="bigBox" method="POST" action="/express/servlet/UserLogin?modth=updatecontrol&id=<%=user.getId() %>" name="update" onsubmit="return check()">
        <h1>查看用户个人信息</h1>
        <font color="red">
            <span id="message">
                <%if(msg==null){msg="";} %>
                <%=msg %>
            </span>
       </font>
        <!-- 用户界面容器 -->
        <div class="inputBox">
            <!-- 用户账号/电话 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-phone"></i>
                    账号:
                </span>
                <input type="text" id="userid" name="userid" placeholder="Userphone" value="<%=user.getUserid() %>">
            </div>
            <!-- 用户电话 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-shouye"></i>
                    电话:
                </span>
                <input type="text" id="tel" name="tel" placeholder="Userphone" value="<%=user.getTel() %>">
            </div>
            <!-- 用户姓名 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-user"></i>
                    姓名:
                </span>
                <input type="text" id="username" name="username" placeholder="Username" value="<%=user.getUsername() %>">
            </div>
            <!-- 密码 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-password"></i>
                    密码:
                </span>
                <input type="text" id="password" name="password" placeholder="Password" value="<%=user.getPassword() %>" >
            </div>
            <!-- 用户地址 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-address"></i>
                    地址:
                </span>
                <input type="text" id="location" name="location" placeholder="Address" value="<%=user.getLocation() %>" >
            </div>
            <!-- 用户积分 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-jifen"></i>
                    积分:
                </span>
                <input type="text" id="integration" name="integration" placeholder="Credit" value="<%=user.getIntegration() %>">
            </div>
            <!-- 用户权限 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-zhanghaoquanxianguanli"></i>
                    权限:
                </span>
                <input type="text" id="role" name="role" placeholder="Role"  value="<%=user.getRole() %>">
            </div>
            <!-- 修改按钮 -->
            <input type="submit" class="inputButton" value="修改">
            <!-- 删除按钮 -->
            <input type="button" class="inputButton" onclick="deleted()" value="删除">
            <!-- 返回按钮 -->
            <a href="admin/user.jsp">
                <input type="button" class="inputButton" value="返回">
            </a>
        </div>
    </form>
  </body>
</html>
